load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

go_library(
    name = "go_default_library",
    srcs = ["smbios.go"],
    importpath = "kubevirt.io/kubevirt/cmd/sidecars/smbios",
    visibility = ["//visibility:private"],
    deps = [
        "//staging/src/kubevirt.io/api/core/v1:go_default_library",
        "//vendor/github.com/spf13/pflag:go_default_library",
        "//vendor/libvirt.org/go/libvirtxml:go_default_library",
    ],
)

go_binary(
    name = "onDefineDomain",
    embed = [":go_default_library"],
    visibility = ["//visibility:public"],
)

pkg_tar(
    name = "onDefineDomain-tar",
    srcs = [":onDefineDomain"],
    package_dir = "/usr/bin",
)

oci_image(
    name = "example-hook-sidecar-image",
    base = "//cmd/sidecars:sidecar-shim-image",
    entrypoint = ["/sidecar-shim"],
    tars = [
        ":onDefineDomain-tar",
    ],
    visibility = ["//visibility:public"],
)

go_test(
    name = "go_default_test",
    srcs = [
        "smbios_suite_test.go",
        "smbios_test.go",
    ],
    embed = [":go_default_library"],
    race = "on",
    deps = [
        "//pkg/hooks/v1alpha1:go_default_library",
        "//pkg/virt-launcher/virtwrap/api:go_default_library",
        "//pkg/virt-launcher/virtwrap/converter:go_default_library",
        "//pkg/virt-launcher/virtwrap/converter/arch:go_default_library",
        "//staging/src/kubevirt.io/api/core/v1:go_default_library",
        "//staging/src/kubevirt.io/client-go/testutils:go_default_library",
        "//vendor/github.com/onsi/ginkgo/v2:go_default_library",
        "//vendor/github.com/onsi/gomega:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
    ],
)
